<template>
  <li class="item">
    <div class="card">
      <div class="img-wrapper">
        <img :src="require(`../../assets/img/${item.name == '元旦' ? '元旦节' : item.name}.jpg`)" alt="">
        <div class="mask">
          <h1>{{ item.name }}</h1>
          <h2>{{ item.startday }}</h2>
        </div>
      </div>
    </div>
  </li>
</template>

<script>
export default {
  props: {
    item: Object,
  }
}
</script>

<style lang="less" scoped>
.item{
  padding: .1rem .15rem;
  box-sizing: border-box;
  .card{
    border: 1px solid #ddd;
    border-radius: .15rem;
    overflow: hidden;   //设置后，会将超出的部分隐藏
    background: #fff;
    box-shadow: .01rem .03rem .05rem #999;
    .img-wrapper{
      position: relative;
      height: 2.2rem;

      .mask{
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, .4);
        display: flex;
        flex-direction: column;  //设置方向轴
        justify-content: center;
        align-items: center;

        h1{
          color: #ed4040;
          font-size: .5rem;
          font-weight: bold;
          text-shadow: .01rem .035rem .05rem #ddd;
        }
        h2 {
          color: #fff;
          font-size: .28rem;
          margin-top: .15rem;
        }
      }
    }
  }
}
</style>